import React from "react"
import { View } from "@tarojs/components"
import clsx from "clsx"
import styles from "./index.module.css"

type IProps = {
  visible: boolean
  message?: string
  title?: string
  onClose(): any
  onConfirm(): any
}
const GpMaskModal: React.FC<IProps> = function GpMask({
  title = "确认跳转",
  message,
  visible,
  onConfirm,
  onClose
}) {
  if (!visible) return null
  return (
    <React.Fragment>
      <View className={styles.mask}></View>
      <View className={styles.content}>
        <View className={styles.contentBody}>
          <View className={styles.title}>{title}</View>
          <View className={styles.body}>{message}</View>
          <View className={styles.btns}>
            <View className={clsx(styles.btn, styles.cancel)} onClick={onClose}>
              取消
            </View>
            <View className={styles.verticalline}></View>
            <View className={clsx(styles.btn, styles.confirm)} onClick={onConfirm}>
              确认
            </View>
          </View>
        </View>
      </View>
    </React.Fragment>
  )
}
export default GpMaskModal
